//
//  DKAuthPrivacyAgreementCell.m
//  DanKU
//
//  Created by 吴斌 on 2023/11/4.
//

#import "DKAuthPrivacyAgreementCell.h"

static NSString * DKAuthPrivacyAgreementCellId = @"DKAuthPrivacyAgreementCellId";

@implementation DKAuthPrivacyAgreementCell
+ (instancetype)authStartAuthenticationCell:(UITableView *)tableView{
    DKAuthPrivacyAgreementCell * dk_AuthPrivacyAgreementCell = [tableView dequeueReusableCellWithIdentifier:DKAuthPrivacyAgreementCellId];
    if (!dk_AuthPrivacyAgreementCell) {
        dk_AuthPrivacyAgreementCell = [[DKAuthPrivacyAgreementCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DKAuthPrivacyAgreementCellId];
    }
    dk_AuthPrivacyAgreementCell.backgroundColor = [UIColor clearColor];
    dk_AuthPrivacyAgreementCell.selectionStyle = UITableViewCellSelectionStyleNone;
    dk_AuthPrivacyAgreementCell.accessoryType = UITableViewCellAccessoryNone;
    return dk_AuthPrivacyAgreementCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    UIButton * dk_AuthPrivacyAgreementBtn = [[UIButton alloc] init];
    [dk_AuthPrivacyAgreementBtn setTitle:@"《Privacy Agreement》" forState:UIControlStateNormal];
    [dk_AuthPrivacyAgreementBtn setTitleColor:DK_Hex(@"#CCCCCC") forState:UIControlStateNormal];
    dk_AuthPrivacyAgreementBtn.titleLabel.font = DK_FONT_Regular(12);
    [dk_AuthPrivacyAgreementBtn addTarget:self action:@selector(checkPrivacyAgreement) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:dk_AuthPrivacyAgreementBtn];
    [dk_AuthPrivacyAgreementBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(-DK_IsWidthScale(0)));
    }];
}
- (void)checkPrivacyAgreement{
    if(self.CheckPrivacyAgreementBlock){
        self.CheckPrivacyAgreementBlock();
    }
}
@end
